import 'package:flutter/material.dart';
import 'package:flutterapp/navigator/nav.dart';
import 'package:provider/provider.dart';
import 'config/provider_config.dart';
import 'model/all_model.dart';

void main() => runApp(ProviderConfig.getInstance().getGlobal(MyApp()));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final model = Provider.of<GlobalModel>(context)..setContext(context);
    return MaterialApp(
      title: 'Welcome',
      home: model.goToLogin
          ? ProviderConfig.getInstance().getLoginPage(isFirst: true)
          : NavStatefulWidget()
    );
  }
}
